public class Main {
    public static void main(String[] args) {
        System.out.println(new Solution().climbStairs(3));
    }
}

class Solution {
    public int climbStairs(int n) {
        if (n == 1) {
            return 1;
        }
        int[] dp = new int[2];
        dp[0] = 1;
        dp[1] = 2;
        for (int i = 2; i < n; i++) {
            int dp2 = dp[1] + dp[0];
            dp[0] = dp[1];
            dp[1] = dp2;
        }
        return dp[1];
    }
}